﻿@{    
    //page title
    ViewBag.Title = T("Admin.Configuration.Tax.Providers").Text;
}
<div class="section-header">
    <div class="title">
        <img src="@Url.Content("~/Administration/Content/images/ico-configuration.png")" alt="" />
        @T("Admin.Configuration.Tax.Providers")
    </div>
</div>
<table class="adminContent">
    <tr>
        <td>
            <div id="tax-providers-grid"></div>

            <script>
                $(document).ready(function () {
                    $("#tax-providers-grid").kendoGrid({
                        dataSource: {
                            type: "json",
                            transport: {
                                read: {
                                    url: "@Html.Raw(Url.Action("Providers", "Tax"))",
                                    type: "POST",
                                    dataType: "json"
                                }
                            },
                            schema: {
                                data: "Data",
                                total: "Total",
                                errors: "Errors"
                            },
                            error: function (e) {
                                display_kendoui_grid_error(e);
                                // Cancel the changes
                                this.cancelChanges();
                            },
                            serverPaging: true,
                            serverFiltering: true,
                            serverSorting: true
                        },
                        pageable: {
                            refresh: true,
                            numeric: false,
                            previousNext: false,
                            info: false
                        },
                        editable: {
                            confirmation: false,
                            mode: "inline"
                        },
                        scrollable: false,
                        columns: [{
                            field: "FriendlyName",
                            title: "@T("Admin.Configuration.Tax.Providers.Fields.FriendlyName")",
                            width: 250
                        }, {
                            field: "SystemName",
                            title: "@T("Admin.Configuration.Tax.Providers.Fields.SystemName")",
                            width: 250
                        }, {
                            field: "IsPrimaryTaxProvider",
                            title: "@T("Admin.Configuration.Tax.Providers.Fields.IsPrimaryTaxProvider")",
                            width: 100,
                            headerAttributes: { style: "text-align:center" },
                            attributes: { style: "text-align:center" },
                            template: '<img src="@Url.Content("~/Administration/Content/images/")active-#=IsPrimaryTaxProvider#.gif" />'
                        }, {
                            field: "SystemName",
                            title: "@T("Admin.Configuration.Tax.Providers.Fields.MarkAsPrimaryProvider")",
                            width: 200,
                            template: '<a href="@Url.Content("~/Admin/Tax/MarkAsPrimaryProvider/")?systemName=#=SystemName#" class="k-button">@T("Admin.Configuration.Tax.Providers.Fields.MarkAsPrimaryProvider")</a>'
                        }, {
                            field: "SystemName",
                            title: "@T("Admin.Configuration.Tax.Providers.Configure")",
                            width: 150,
                            template: '<a href="ConfigureProvider?systemName=#=SystemName#">@T("Admin.Configuration.Tax.Providers.Configure")</a>'
                        }]
                    });
                });
            </script>
        </td>
    </tr>
</table>
